const http = require('http');

const sv = http.createServer((req,res)=>{
    res.writeHead(200, {'content-type':'text/html;charset=utf-8'});

    // 声明变量
    let body = '';

    // 接收 POST 请求体
    req.on('data',(chunk)=>{
        body += chunk;
    });

    // 接收 POST 请求体结束
    req.on('end',()=>{
        console.log('POST 请求体:', body);
        res.end('<h2>Wecome！</h2>')
    });

});

sv.listen(3000,()=>{
    console.log('Server is running at http://localhost:3000');
});